package java6.src.chapter02;

import java.util.Scanner;
public class Traning09 {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);

            System.out.println("请输入学生人数：");
            int numberOfStudents = scanner.nextInt();

            double[] scores = new double[numberOfStudents];

            System.out.println("请输入学生成绩，成绩之间用空格隔开：");
            for (int i = 0; i < numberOfStudents; i++) {
                scores[i] = scanner.nextDouble();
            }
            double totalScore = 0;
            double maxScore = scores[0];
            double minScore = scores[0];

            for (double 55score : scores) {
                totalScore += score;
                if (score > maxScore) {
                    maxScore = score;
                }
                if (score < minScore) {
                    minScore = score;
                }
            }
            double averageScore = totalScore / numberOfStudents;

            System.out.println("最高分：" + maxScore);
            System.out.println("最低分：" + minScore);
            System.out.println("平均分：" + averageScore);

            scanner.close();
        }
    }



